package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PersonalAwardsMapper;
import com.ruoyi.system.domain.PersonalAwards;
import com.ruoyi.system.service.IPersonalAwardsService;

/**
 * 个人奖项Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-25
 */
@Service
public class PersonalAwardsServiceImpl implements IPersonalAwardsService 
{
    @Autowired
    private PersonalAwardsMapper personalAwardsMapper;

    /**
     * 查询个人奖项
     * 
     * @param id 个人奖项主键
     * @return 个人奖项
     */
    @Override
    public PersonalAwards selectPersonalAwardsById(Long id)
    {
        return personalAwardsMapper.selectPersonalAwardsById(id);
    }

    /**
     * 查询个人奖项列表
     * 
     * @param personalAwards 个人奖项
     * @return 个人奖项
     */
    @DataScope(deptAlias = "d", userAlias = "u")
    @Override
    public List<PersonalAwards> selectPersonalAwardsList(PersonalAwards personalAwards)
    {
        return personalAwardsMapper.selectPersonalAwardsList(personalAwards);
    }

    /**
     * 新增个人奖项
     * 
     * @param personalAwards 个人奖项
     * @return 结果
     */
    @Override
    public int insertPersonalAwards(PersonalAwards personalAwards)
    {
        personalAwards.setDeptId(SecurityUtils.getDeptId());
        personalAwards.setUserId(SecurityUtils.getUserId());
        personalAwards.setCreateTime(DateUtils.getNowDate());
        return personalAwardsMapper.insertPersonalAwards(personalAwards);
    }

    /**
     * 修改个人奖项
     * 
     * @param personalAwards 个人奖项
     * @return 结果
     */
    @Override
    public int updatePersonalAwards(PersonalAwards personalAwards)
    {
        personalAwards.setUpdateTime(DateUtils.getNowDate());
        return personalAwardsMapper.updatePersonalAwards(personalAwards);
    }

    /**
     * 批量删除个人奖项
     * 
     * @param ids 需要删除的个人奖项主键
     * @return 结果
     */
    @Override
    public int deletePersonalAwardsByIds(Long[] ids)
    {
        return personalAwardsMapper.deletePersonalAwardsByIds(ids);
    }

    /**
     * 删除个人奖项信息
     * 
     * @param id 个人奖项主键
     * @return 结果
     */
    @Override
    public int deletePersonalAwardsById(Long id)
    {
        return personalAwardsMapper.deletePersonalAwardsById(id);
    }
}
